package com.bwie.controller;

import com.bwie.pojo.CouponList;
import com.bwie.pojo.CustomerAddress;
import com.bwie.pojo.ServiceType;
import com.bwie.pojo.TbOrder;
import com.bwie.service.*;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import com.sun.org.apache.bcel.internal.generic.RET;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @projectName: day0711
 * @package: com.bwie.controller
 * @className: IndexController
 * @author: 杨珂
 * @description: TODO
 * @date: 2025/7/11 16:04
 * @version: 1.0
 */
@RestController
@RequestMapping("/order/index")
public class IndexController {


    @Autowired
    ServiceTypeService serviceTypeService;

    @Autowired
    TbOrderService tbOrderService;

    @Autowired
    CustomerAddressService addressService;

    @Autowired
    CouponListService couponListService;


    @PostMapping("/getItemByTypeId/{typeId}")
    public R getItemByTypeId(@PathVariable("typeId") Integer typeId) {
        return serviceTypeService.getItemByTypeId(typeId);
    }


    @PostMapping("/addOrder")
    public R addOrder(@RequestBody TbOrder tbOrder) {
        return tbOrderService.addOrder(tbOrder);
    }

    @PostMapping("/getAddressList")
    public R getAddressList() {
        return addressService.getAddressList();
    }

    @PostMapping("/getCouponList")
    public R getCouponList() {
        return couponListService.getCouponList();
    }

    @PostMapping("/getOrderList")
    public R getOrderList() {
        return tbOrderService.getOrderList();
    }


}
